import requests
from lxml import etree
from log.header import get_headers
url = 'https://ssr3.scrape.center/'
# 加http带用户密码才放行
response = requests.get(url,get_headers(),auth=('admin','admin'))
# print(response.text)

tree = etree.HTML(response.text)
datas = tree.xpath('//div[@class = "el-card__body"]')
for data in datas:
    img = data.xpath('.//img[@class="cover"]/@src')[0]
    title = data.xpath('.//h2/text()')[0]
    print(img,title)